﻿using UnityEngine;
using System.Collections;

public class Rotator : MonoBehaviour 
{
	public float speed;
	public string rotateAxis;

	private Transform myTransform;

	void Start()
	{
		myTransform = transform;
	}

	void Update()
	{
		if(rotateAxis == "x")
		{
			Vector3 rotation = new Vector3(speed, 0.0f, 0.0f);
			myTransform.Rotate (rotation * Time.deltaTime);
		}
		else if(rotateAxis == "y")
		{
			Vector3 rotation = new Vector3(0.0f, speed, 0.0f);
			myTransform.Rotate (rotation * Time.deltaTime);
		}
		else if(rotateAxis == "z")
		{
			Vector3 rotation = new Vector3(0.0f, 0.0f, speed);
			myTransform.Rotate (rotation * Time.deltaTime);
		}

	}
}
